layui.use(['form', 'jquery', 'layer'], function () {
    var form = layui.form,
        layer = layui.layer,
        $ = layui.jquery;


    form.on('submit(updateBasic)', function (data) {
        var index = layer.msg("数据提交中，请稍后", {
            icon: 16,
            time: false,
            shade: 0.8
        })
        var formData = data.field;
        var url = ctx + "/sale/updateBasic";

        $.ajax({
            type: "post",
            url: url,
            data: formData,
            success: function (data) {
                if (data.code == 200) {
                    layer.closeAll("iframe");
                    layer.msg(data.msg, {time: 1000})

                    parent.location.reload();
                }
            }, error: function (data) {
                layer.closeAll("iframe");
                layer.msg(data.msg, {time: 1000})
            }
        })

        return false;

    })
})